#!/usr/bin/python3

exit_key = ["exit", "q", "Q", "", " "]
cats_file="cats.txt"
dogs_file="dogs.txt"
cats_prompt="Please type you favor cats:\n"
dogs_prompt="Please type you favor dogs:\n"


def write_animal_to_file(animal_type):
    file_name=f"{animal_type}s.txt"
    with open(file_name,"w") as animal_object:
        while True:
            animals = input(f"Please type your favor {animal_type}:\n")
            if animals in exit_key:
                break
            animals += "\n"
            animal_object.write(animals)

write_animal_to_file("dog")
write_animal_to_file("cat")
